/***************************************************************************//**
 * @file     bl_can.h
 * @brief    This file is the header file of bootloader CAN configuration.
 * @brief    This file configs the CAN of bootloader.
 * @version  V1.4.0
 * @date     May-2020
 * @author   Zhixin Semiconductor
 *
 * @note
 * Copyright (C) 2020-2022 Zhixin Semiconductor Ltd. All rights reserved.
 *
 ******************************************************************************/
#ifndef BL_CAN_H
#define BL_CAN_H



#include "bl_message.h"
#include "Z20K11xM_can.h"
#include "common_types.h"

#define CAN_IRQ_NUM        CAN0_IRQn 




#define CAN_REC_MB         0U
#define CAN_SEND_MB        1U
#define CAN_ID             CAN_ID_0
#define CLK_CAN_ID         CLK_CAN0
#define SYSCTRL_CAN_ID     SYSCTRL_CAN0
//#define CAN_IRQ_NUM        CAN0_IRQn 

/*
#define CAN_BUF_QUEUE_LENGTH   16U

typedef struct
{
    uint32_t index;
    uint32_t header;
    uint32_t freeCnt;
    CAN_MsgBuf_t  rxFrames[CAN_BUF_QUEUE_LENGTH];    
}CanFdBufQueue_t;
*/
//extern CanFdBufQueue_t canRxBufQueue;

void CanReset(void);
//FlagStatus_t CanReadOneFrame(MessageBuf_t *buf);

void CanInit(void);
ResultStatus_t CanSendMsg(uint32_t msgId, const uint8_t *msgData);
void CanfdProcess(void);

#endif /* BL_CAN_H */